package cmpe.swe.purcom.dao.extractor;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;

import cmpe.swe.purcom.model.Service;

public class ServiceResultSetExtractor implements ResultSetExtractor<Service> {

	@Override
	public Service extractData(ResultSet rs) throws SQLException,
			DataAccessException {
		Service ser = new Service();
		ser.setId(rs.getLong(1));
		ser.setName(rs.getString(2));
		ser.setDescription(rs.getString(3));
		ser.setServiceNumberRequested(rs.getInt(4));
		ser.setEndDateTime(rs.getTimestamp(5));
		ser.setLocation(rs.getString(6));
		ser.setCommunityid(rs.getLong(7));
		ser.setServiceNumberContributed(rs.getInt(8));
		return ser;
	}

}
